# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test01
# Description:  例8.1
# Author:       ASUS
# Date:         2019/3/11
#-------------------------------------------------------------------------------


# 创建类Person
class Person:
    def setName(self,name):
        self.name = name
    def getName(self):
        return self.name
    def greet(self):
        print("Hello,I'am {name}.".format(name = self.name))

# 创建对象person1
person1 = Person()
person2 = Person()
person1.setName("Bill Gates")
print(person1.getName())
person1.greet()
person2.name = "Bill Clinton"                  #name是Person类的属性，可以在外部访问
print(person2.name)
Person.greet(person2)                          #通过类调用方法


